﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using KPIS.GERP.GBMS.BLL;
using KPIS.GERP.GBMS.IBLL;
using KPIS.GERP.GBMS.MODEL;
using Telerik.Web.UI;

namespace KPIS.GERP.GBMS.APP_UI.UserControls
{
    public partial class ChangeExpense : System.Web.UI.UserControl
    {
        private IExpenseGroupBLL expGrp = new ExpenseGroupBLL();
        private IProject proj = new Project_BLL();
        private IExpenseBLL exp = new ExpenseBLL();
        public string strBgmProjSeq = "";
        public string strBgmSourceSeq = "";

        protected void Page_Load(object sender, EventArgs e)
        {
            //if (!IsPostBack)
            //{
            //    hBgmProjSeq.Value = Session["BgmProjSeq"].ToString();
            //    hBgmSourceSeq.Value = Session["BgmSourceSeq"].ToString();

            //    LoadExpenseGroup();
            //    LoadOldExpense();
            //}
        }

        public void LoadChangeExpense(string strBgmProjSeq, string strBgmSourceSeq)
        {
            hBgmProjSeq.Value = strBgmProjSeq;
            hBgmSourceSeq.Value = strBgmSourceSeq;

            LoadExpenseGroup();
            LoadOldExpense();
        }

        protected void LoadExpenseGroup()
        {
            cbExpenseGroup.DataSource = expGrp.Search(0, "", "", "", 0, 0);
            cbExpenseGroup.DataBind();

            cbExpenseGroup.SelectedIndex = 0;
        }

        protected void LoadOldExpense()
        {
            RpOldExpense.DataSource = proj.GetDataProjectExpenseOnlyExp(
                hBgmProjSeq.Value, hBgmSourceSeq.Value, cbExpenseGroup.SelectedValue);
            RpOldExpense.DataBind();
        }

        protected void cmdAddExpense_Click(object sender, EventArgs e)
        {

        }

        protected void cbExpenseGroup_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
        {
            LoadOldExpense();
        }
    }
}